package com.longe.security;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.PermissionResolver;
import org.apache.shiro.authz.permission.WildcardPermission;

/**
 * 自定义的Permission解析
 */
@Slf4j
public class MyPermissionResolver implements PermissionResolver {

    @Override
    public Permission resolvePermission(String s) {

        log.debug("s => " + s);

        /**url格式**/
        if(s.startsWith("/")){
            return new MyUrlPermission(s);
        }
        /**默认A:*格式**/
        return new WildcardPermission(s);
    }
}
